dynamics_geometry Module



Contents


Interfaces

public interface assignment(=)

  • private pure elemental subroutine plane_assign(x, y)

    Assigns a plane to another.

    Arguments

    Type IntentOptional Attributes Name
    type(plane), intent(out) :: x

    The resulting plane.

    type(plane), intent(in) :: y

    The source plane

  • private pure elemental subroutine line_assign(x, y)

    Assigns a line to another.

    Arguments

    Type IntentOptional Attributes Name
    type(line), intent(out) :: x

    The resulting line.

    type(line), intent(in) :: y

    The source line

public interface is_parallel

  • private pure function is_parallel_vectors(x, y, tol) result(rst)

    Tests to see if two vectors are parallel.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:) :: x

    The first vector.

    real(kind=real64), intent(in), dimension(size(x)) :: y

    The second vector.

    real(kind=real64), intent(in), optional :: tol

    The tolerance to use when testing for parallelism. The default tolerance is 10x machine epsilon.

    Return Value logical

    Returns true if the vectors are parallel; else, false.

  • private pure function is_parallel_lines(x, y, tol) result(rst)

    Tests to see if two lines are parallel.

    Arguments

    Type IntentOptional Attributes Name
    class(line), intent(in) :: x

    The first line.

    class(line), intent(in) :: y

    The second line.

    real(kind=real64), intent(in), optional :: tol

    The tolerance to use when testing for parallelism. The default tolerance is 10x machine epsilon.

    Return Value logical

    Returns true if the lines are parallel; else, false.

  • private pure function is_parallel_planes(x, y, tol) result(rst)

    Tests to see if two planes are parallel.

    Arguments

    Type IntentOptional Attributes Name
    class(plane), intent(in) :: x

    The first plane.

    class(plane), intent(in) :: y

    The second plane.

    real(kind=real64), intent(in), optional :: tol

    The tolerance to use when testing for parallelism. The default tolerance is 10x machine epsilon.

    Return Value logical

    Returns true if the planes are parallel; else, false.

public interface line

  • private pure function line_from_2pts(pt1, pt2) result(rst)

    Constructs a line from two points.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: pt1(3)

    The first point. This point will act as the initial point along the line such that in the equation of the line .

    real(kind=real64), intent(in) :: pt2(3)

    The second point.

    Return Value type(line)

    The resulting line.

  • private pure function line_from_2_planes(p1, p2) result(rst)

    Constructs a line from the intersection of two planes.

    Arguments

    Type IntentOptional Attributes Name
    class(plane), intent(in) :: p1

    The first plane.

    class(plane), intent(in) :: p2

    The second plane.

    Return Value type(line)

    The resulting line. NaN's are returned in the event that the two planes are parallel.

  • private pure function line_from_many_points(pts) result(rst)

    Constructs the line that best fits the supplied set of points in a least-squares sense.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: pts

    An N-by-3 matrix where N is at least 2, but typically much larger.

    Return Value type(line)

    The resulting line.

public interface plane

  • private pure function plane_from_3pts(pt1, pt2, pt3) result(rst)

    Constructs a plane from 3 points. The 3 points must not be colinear.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: pt1(3)

    The first point.

    real(kind=real64), intent(in) :: pt2(3)

    The second point.

    real(kind=real64), intent(in) :: pt3(3)

    The third point.

    Return Value type(plane)

    The resulting plane.

  • private pure function plane_from_point_and_normal(pt, nrm) result(rst)

    Constructs a plane from a point which lies on the plane, and a unit vector normal to the plane.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: pt(3)

    The point that lies on the plane.

    real(kind=real64), intent(in) :: nrm(3)

    The normal unit vector.

    Return Value type(plane)

    The resulting plane.

  • private pure function plane_from_many_points(pts) result(rst)

    Constructs the plane that best fits a cloud of points in a least-squares sense.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: pts

    The N-by-3 matrix containing the N points to fit. N must be at least 3, but is typically much larger.

    Return Value type(plane)

    The resulting plane.


Derived Types

type, public ::  line

Defines the parametric form of a line .

Components

Type Visibility Attributes Name Initial
real(kind=real64), public :: r0(3)

The coordinates of the initial point .

real(kind=real64), public :: v(3)

The vector defining the orientation of the line.

Constructor

private pure function line_from_2pts (pt1, pt2)

Constructs a line from two points.

private pure function line_from_2_planes (p1, p2)

Constructs a line from the intersection of two planes.

private pure function line_from_many_points (pts)

Constructs the line that best fits the supplied set of points in a least-squares sense.

Type-Bound Procedures

procedure , public :: evaluate => line_eval Function

type, public ::  plane

Defines a plane as .

Components

Type Visibility Attributes Name Initial
real(kind=real64), public :: a

The x-component of the plane normal vector.

real(kind=real64), public :: b

The y-component of the plane normal vector.

real(kind=real64), public :: c

The z-component of the plane normal vector.

real(kind=real64), public :: d

The offset from the origin.

Constructor

private pure function plane_from_3pts (pt1, pt2, pt3)

Constructs a plane from 3 points. The 3 points must not be colinear.

private pure function plane_from_point_and_normal (pt, nrm)

Constructs a plane from a point which lies on the plane, and a unit vector normal to the plane.

private pure function plane_from_many_points (pts)

Constructs the plane that best fits a cloud of points in a least-squares sense.

Type-Bound Procedures

procedure , public :: flip_normal => plane_flip_normal Subroutine

Functions

public pure function is_point_on_line(pt, ln, tol) result(rst)

Tests to see if a point lies on a line.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(line), intent(in) :: ln

The line.

real(kind=real64), intent(in), optional :: tol

The tolerance to use when testing. The default tolerance is 10x machine epsilon.

Return Value logical

Returns true if the point lies on the line; else, false.

public pure function is_point_on_plane(pt, pln, tol) result(rst)

Tests to see if a point lies on a plane.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(plane), intent(in) :: pln

The plane.

real(kind=real64), intent(in), optional :: tol

The tolerance to use when testing. The default tolerance is 10x machine epsilon.

Return Value logical

Returns true if the point lies on the plane; else, false.

public pure function nearest_point_on_line(pt, ln) result(rst)

Gets the line parameter for the point on the line nearest the specified point.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(line), intent(in) :: ln

The line.

Return Value real(kind=real64)

The line parameteric variable defining the location of the point nearest along the line.

public pure function plane_normal(pln) result(rst)

Returns the normal vector of a plane.

Arguments

Type IntentOptional Attributes Name
type(plane), intent(in) :: pln

The plane.

Return Value real(kind=real64), (3)

The normal vector.

public pure function point_plane_projection(pt, pln) result(rst)

Projects a point onto a plane.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(plane), intent(in) :: pln

The plane onto which to project the point.

Return Value real(kind=real64), (3)

The projected point.

public pure function point_to_line_distance(pt, ln) result(rst)

Computes the shortest distance between a point and a line.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(line), intent(in) :: ln

The line.

Return Value real(kind=real64)

The shortest distance between the point and line.

public pure function point_to_plane_distance(pt, pln) result(rst)

Computes the shortest distance between a point and a plane.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: pt(3)

The point.

class(plane), intent(in) :: pln

The plane.

Return Value real(kind=real64)

The shortest distance between the point and plane.

public pure function vector_plane_projection(x, pln) result(rst)

Projects a vector onto a plane.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: x(3)

The vector to project.

class(plane), intent(in) :: pln

The plane onto which to project the vector.

Return Value real(kind=real64), (3)

The projected vector.